package com.demostic.demostic_test.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.demostic.demostic_test.R;

public class TypeAdapter extends RecyclerView.Adapter<TypeAdapter.ViewHolder> {
    private Context context;
    private OnContentClickListener mListener;
    private int[] resArray = {R.drawable.image_x420, R.drawable.image_x430, R.drawable.image_x610, R.drawable.image_x620, R.drawable.image_x660, R.drawable.image_x660, R.drawable.image_x782, R.drawable.image_x785, R.drawable.image_x786, R.drawable.image_x786, R.drawable.image_x786, R.drawable.image_x800, R.drawable.image_x900, R.drawable.image_x900, R.drawable.image_x900};
    private String[] strArray;

    public interface OnContentClickListener {
        void onContentClick(int i);
    }

    public TypeAdapter(Context context2, String[] strArray2) {
        this.context = context2;
        this.strArray = strArray2;
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(this.context).inflate(R.layout.devicie_type_item, parent, false));
    }

    public void onBindViewHolder(final ViewHolder holder, int position) {
        Glide.with(this.context).load(Integer.valueOf(this.resArray[position])).into(holder.image_product);
        holder.tv_product.setText(this.strArray[position]);
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            /* class com.demostic.demostic_test.adapter.TypeAdapter.AnonymousClass1 */

            @Override // android.view.View.OnClickListener
            public void onClick(View v) {
                TypeAdapter.this.mListener.onContentClick(holder.getLayoutPosition());
            }
        });
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public int getItemCount() {
        return this.strArray.length;
    }

    /* access modifiers changed from: package-private */
    public class ViewHolder extends RecyclerView.ViewHolder {
        ImageView image_go;
        ImageView image_product;
        RelativeLayout rl_type;
        TextView tv_product;
        View view_line;

        public ViewHolder(View itemView) {
            super(itemView);
            this.image_product = (ImageView) itemView.findViewById(R.id.image_product);
            this.tv_product = (TextView) itemView.findViewById(R.id.tv_product);
            this.rl_type = (RelativeLayout) itemView.findViewById(R.id.rl_type);
            this.image_go = (ImageView) itemView.findViewById(R.id.image_go);
            this.view_line = itemView.findViewById(R.id.view_line);
        }
    }

    public void setContentClickListener(OnContentClickListener listener) {
        this.mListener = listener;
    }
}
